package com.star.message.api;

import com.star.message.api.contract.command.SendSmsCommand;
import com.star.message.api.service.MessageSmsApi;
import com.star.message.biz.MessageSmsBizService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消息中心之短信服务控制器
 *
 * @author zhouhengzhe
 * @version 1.0
 * @date 2023/11/29 17:10
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "短信中心", description = "短信api")
public class MessageSmsApiController implements MessageSmsApi {

    private final MessageSmsBizService messageSmsBizService;

    /**
     * 发送短信
     *
     * @param sendSmsCommand 短信发送命令
     */
    @Override
    @Operation(summary = "发送短信")
    public void sendSms(SendSmsCommand sendSmsCommand) {
        messageSmsBizService.sendSms(sendSmsCommand.getTenantId(), sendSmsCommand.getLanguageCode(), sendSmsCommand.getCountryCode(), sendSmsCommand.getPhone(), sendSmsCommand.getCodeMap());
    }
}
